package com.example.httpprocessor.http;

import java.util.Map;

/**
 * 业务员   代理类
 */
public class HttpHelper implements IHttpProcessor{

    //  定义一个业主，卖房子的人
    private static IHttpProcessor mIHttpProcessor = null;
    //  通过一个API来设置哪一个业主卖出自己的房子，（谁来完成网络访问）
    public static void init(IHttpProcessor httpProcessor) {
        mIHttpProcessor = httpProcessor;
    }

    //  单例
    private static HttpHelper instance;
    public static HttpHelper obtain(){
        synchronized (HttpHelper.class) {
            if (instance == null) {
                instance = new HttpHelper();
            }
        }
        return instance;
    }

    private HttpHelper(){};


    @Override
    public void post(String url, Map<String, Object> params, HttpCallback callback) {
          mIHttpProcessor.post(url,params,callback);
    }
}
